package com.bcd.beans;

import com.bcd.model.ArticleType;

public class ArticleFactory {
	public static Article newArticle(ArticleType articleType){
		return getArticle(articleType);
	}
	public static Article newArticle(String articleType){
		return getArticle(ArticleType.valueOf(articleType));
	}
	private static Article getArticle(ArticleType articleType){
		Article article = null;
		switch (articleType){
			case BOOK:
				article = new Book();
				break;				
			case CD:
				article = new CD();
				break;				
			case DVD:
				article = new DVD();
				break;
			default:
				article = new Book();
		}
		return article;
	}
}
